<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>HbaseAdmin-登录页面</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="/static/fontawesome-free/css/all.min.css">
    <link rel="stylesheet" href="/static/dist/css/adminlte.min.css">
</head>
<body class="hold-transition login-page">
<div class="login-box">
    <div class="login-logo">
        <a href="#"><b>Hbase</b>Admin</a>
    </div>
    <!-- /.login-logo -->
    <div class="card">
        <div class="card-body login-card-body">
            <p class="login-box-msg">请先登录</p>

            <form action="" method="post">
                <div class="input-group mb-3">
                    <input type="text" value="admin"  id="username" class="form-control" placeholder="用户名">
                    <div class="input-group-append">
                        <div class="input-group-text">
                            <span class="fas fa-envelope"></span>
                        </div>
                    </div>
                </div>
                <div class="input-group mb-3">
                    <input type="password" value="123456" id="password" class="form-control" placeholder="密码">
                    <div class="input-group-append">
                        <div class="input-group-text">
                            <span class="fas fa-lock"></span>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <!-- /.col -->
                    <div class="col-4">
                        <button type="button" onclick="login()" class="btn btn-primary btn-block">登录</button>
                    </div>
                    <!-- /.col -->
                </div>
            </form>

        </div>
        <!-- /.login-card-body -->
    </div>
</div>
<!-- /.login-box -->

<!-- jQuery -->
<script src="/static/plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="/static/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="/static/dist/js/adminlte.min.js"></script>
<script type="text/javascript">
    function login() {
        var username = $('#username').val();
        var password = $('#password').val();
        if(username == '') {
            alert("用户名不能为空");
            return;
        }
        if(password == '') {
            alert("密码不能为空");
            return;
        }
        var data = {username:username,password:password};
        $.ajax({
            url: '/login/do',
            type: 'get',
            data: data,
            success: function (result) {
                if(result.code!=200) {
                    alert("账号有误");
                } else {
                    window.location.href="/";
                }
            }
        });

    }
</script>
</body>
</html>
